package com.micro.ai.models.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 模型供应商实体类
 * 用于管理AI模型的供应商信息，包括OpenAI、Anthropic、Google等
 * 
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName("model_vendors")
@Schema(description = "模型供应商信息")
public class ModelVendor implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "供应商ID", example = "vendor_123456789")
    private String id;

    /**
     * 租户ID
     */
    @NotBlank(message = "租户ID不能为空")
    @Schema(description = "租户ID", example = "tenant_001", required = true)
    private String tenantId;

    /**
     * 供应商名称，如：OpenAI、Anthropic、Google、阿里云等
     */
    @NotBlank(message = "供应商名称不能为空")
    @Schema(description = "供应商名称", example = "OpenAI", required = true)
    private String vendorName;

    /**
     * 供应商代码，唯一标识符，如：openai、anthropic、google等
     */
    @NotBlank(message = "供应商代码不能为空")
    @Pattern(regexp = "^[a-z0-9_]+$", message = "供应商代码只能包含小写字母、数字和下划线")
    @Schema(description = "供应商代码（唯一标识符）", example = "openai", required = true)
    private String vendorCode;

    /**
     * API基础URL
     */
    @Schema(description = "API基础URL", example = "https://api.openai.com/v1")
    private String baseUrl;

    /**
     * 官网地址
     */
    @Schema(description = "官网地址", example = "https://openai.com")
    private String website;

    /**
     * 支持联系方式（邮箱或电话）
     */
    @Schema(description = "支持联系方式", example = "support@openai.com")
    private String supportContact;

    /**
     * 状态：active-活跃, inactive-停用
     */
    @Schema(description = "状态（active-活跃，inactive-停用）", example = "active", allowableValues = {"active", "inactive"})
    private String status;

    /**
     * 供应商描述
     */
    @Schema(description = "供应商描述", example = "OpenAI是一家专注于AI研究的公司，提供GPT系列模型")
    private String description;

    /**
     * 配置模板（JSON）
     */
    @Schema(description = "配置模板（JSON格式）", example = "{\"model\":\"gpt-4\",\"temperature\":0.7}")
    private String configTemplate;

    /**
     * 认证配置（JSON）
     */
    @Schema(description = "认证配置（JSON格式）", example = "{\"type\":\"bearer\",\"header\":\"Authorization\"}")
    private String authConfig;

    /**
     * 创建人ID
     */
    @Schema(description = "创建人ID", example = "1001")
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间", example = "2025-01-01 00:00:00")
    private LocalDateTime createdAt;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间", example = "2025-01-01 00:00:00")
    private LocalDateTime updatedAt;
}
